home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Snippets / Development Tools & Languages / DTSCPlusLibrary / Sources / VolumeTest.cp < prev    next >
Encoding:
Text File  |  1993-01-14  |  2.2 KB  |  65 lines  |  [TEXT/MPS ]

  1. /* _________________________________________________________________________________________________________ //
  2.   Copyright © 1993 Apple Computer, Inc. All rights reserved.
  3.   Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
  4.   Programmer: Kent Sandvik
  5.   Date: 1/5/93
  6.   Revision comments are at the end of this file.
  7.   ---
  8.   TVolume is a simple volume based utility class (provides information about volumes)     
  9.   TVolumeTest.cp contains the TVolume testing functions. 
  10.   _________________________________________________________________________________________________________ */
  11.  
  12. #ifndef _VOLUME_
  13. #include "Volume.h"
  14. #endif
  15.  
  16.  
  17. // This test will first look at the boot volume, and print out information
  18. // about the volume structure.
  19.  
  20. void main(void)
  21. {
  22.     cout << "Start of the TVolume object test…\n";
  23.  
  24.     // Create a TVolume object.
  25.     TVolume myVolumes;
  26.  
  27.     // Print out default (boot volume) information.
  28.     cout << "VRefNum of boot volume is = " << myVolumes.GetBootVRefNum() << '\n';
  29.     cout << "Free space (K) of boot volume is = " << myVolumes.GetKFreeSpace() << '\n';
  30.     cout << "Num files on boot volume is = " << myVolumes.GetFileCount() << '\n';
  31.     cout << "Num folders on boot volume is = " << myVolumes.GetDirCount() << '\n';
  32.     cout << "Cretion date of boot volume is = " << myVolumes.GetCreationDate() << '\n';
  33.     cout << "Driver number of boot volume is = " << myVolumes.GetDriverNumber() << '\n';
  34.  
  35.  
  36.     // Get volume name.
  37.     Str255 name;
  38.     myVolumes.GetName(name);
  39.     p2c(name);
  40.     printf("Name of boot volume is = %s\n", name);
  41.  
  42.     // Iterate through the volumes
  43.     cout << "Num volumes mounted is = " << myVolumes.GetNumVolumes() << '\n';
  44.  
  45.     // show file num information on each mounted volume.
  46.     for (myVolumes.Reset(); !myVolumes.Last(); myVolumes.Next())
  47.     {
  48.         cout << "Num files on volume = " << myVolumes.GetFileCount() << '\n';
  49.         cout << "Free space (K) of  volume is = " << myVolumes.GetKFreeSpace() << '\n';
  50.         cout << '\n';
  51.     }
  52.  
  53.     cout << "End of the TVolume object test!\n";
  54. }
  55.  
  56.  
  57. // _________________________________________________________________________________________________________ //
  58.  
  59.  
  60. /*    Change History (most recent last):
  61.   No        Init.    Date        Comment
  62.   1            khs        1/5/93        New file
  63.   2            khs        1/7/93        Cleanup
  64. */
  65.